'use strict';

const BaseController = require('../base');

class BalanceRecordController extends BaseController {
  static get serviceName() {
    return 'business.balanceRecord';
  }

  getCustomerOrder() {
    return [
        ['order_id', 'DESC'],
        ['create_time', 'DESC'],
        ['user_type', 'DESC']
    ]
  }

  async withdraw() {
      const result = await this.service.withdraw(this.ctx.request.body);
      this.ctx.success(result);
  }

  async todayTotal() {
      const { user_id } = this.ctx.query;
      const result = await this.service.getTodayWithdrawTotal(user_id);
      this.ctx.success({ total: result });
  }
}

module.exports = BalanceRecordController;
